define(function(require, exports, module) {
	'use strict';
	require('resource/font-awesome-4.7.0/css/font-awesome.min.css');
	function isUndefined(i) {
		return "undefined" == typeof i;
	}

	function isString(i) {
		return typeof i == "string";
	}
	function loading(jq, conf){
		var defaults = {
				msg:'loading...',
				isModel:false
		}
		var opt = this.options = $.extend({}, defaults, conf);
		var $body = $(jq);
		if(!opt.isModel){
			$body = $(window.parent.document).find('body');
		}
		$body.append(
			'<div class="loadding loading-body" style="width:100%;height: 100%;top:0;left:0;z-index:10000;position: fixed;">'
			+'<div style="width:100%;height:100%;background:#000;opacity: 0.40;"></div>'
			+'<div style="z-index:10001;color:#fff;position: absolute;top: 35%;left: 45%;">'
			+'<i class="fa fa-spinner fa-spin fa-3x fa-fw" style="font-size:60px;"></i>'
			+'<span style="font-size:13px;text-align:center;width:75px;display:block;padding-top:3px;">'+opt.msg+'</span></div></div>');
		this.loading = $body.find('.loading-body');
	}
	loading.prototype={
			constructor: loading,
			show:function(){
				this.loading.show();
			},
			hide:function(){
				this.loading.remove();
			}
	};
	$.fn.loading = function(conf){
		var r, a = Array.prototype.slice.call(arguments, 1);
		return this.each(function() {
			var method, load= $(this).data('loading');
			if (!load) {
				$(this).data('loading', load = new loading(this, conf));
			}
			isString(conf) && $.isFunction(method = load[conf]) && (r = method.apply(load, a))
		}), isUndefined(r) ? this : r
	};
});